<?php

$newlang = $_REQUEST["l"];

$user = getUserLoggedIn();

if(isset($user)){
	$user->attributes->lang = $newlang;
	$_SESSION["userlang"] = $newlang;
	$user->save();
}

setcookie('lang',$newlang,time() + (86400 * 7), '/');
include_once dirname(dirname(dirname(__FILE__)))."/language/" . getLanguage() . ".php";
logSuccess(langEcho("lang:change:success"));
forward($_SERVER["HTTP_REFERER"]);

?>